let app = getApp()
Component({
    properties: {
 
      },
      data:{
        moneySign:'¥',
        background:'rgba(51,51,51,0.2)',
        title: "专栏列表",
        init: !1,
        cate: [],
        topRefresh: 0,
        bottomRefresh: 0,
        activeIndex: 0,
        activeSecondIndex: 0,
        page_path: "pages/series-list/index",
        showH5: !1,
        class_id: 0,
        list: []
      },
    lifetimes: {
        attached: function () {
          var that=this
          that.setData({
            globalColor:app.globalData.globalColor
          })
          wx.request({
              url: app.globalData.siteroot,
              data: { 
                do:'Knowledge_getKnowledgeClass',
                class_type:2
              },
              success: function(res) {
                 var cate=res.data.data
                 for(var s=0;s<cate.length; s++){
                    cate[s].children.unshift({
                       id:0,
                       name: "全部"
                   }) 
                 }
                that.setData({
                  cate:cate
                 })
                that.Knowledge_getColumnList(res.data.data[0].id)
              }
            })
       }
      },
    methods: {
      jumpdetail:function(e){
        var id=e.currentTarget.dataset.id;
        wx.navigateTo({ 
           url: '/yb_shopv2/native/all/index?type=series_detail&id='+id,
        })
      },
      activechange:function(e){
        var index=e.currentTarget.dataset.index;
        this.setData({
           activeIndex:index
        })
       },
       secondchange:function(e){
         var index=e.currentTarget.dataset.index;
         this.setData({
           activeSecondIndex:index
         })
        },
      Knowledge_getColumnList:function(class_id){
        var that=this
        wx.request({
          url: app.globalData.siteroot,
          data: { 
            do:'Knowledge_getColumnList',
            class_id:class_id,
            user_id:wx.getStorageSync('user_id')
          },
          success: function(res) {
            that.setData({
              list:res.data.data
            })
             console.log(res.data)
          }
        })
      }
    }
});
